package com.yichen.music;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.music.Utils.AllCateUtil;
import com.yichen.util.ActorsUtils;

import android.app.Activity;
import android.app.ListActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;

/**
 * 分类歌手信息
 * 
 * @author yangyong
 * 
 */
public class ActorsCateList extends ListActivity implements OnItemClickListener {

	List<String> actor_type_data;
	List<Map<String, String>> data_base;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		// ActorsUtils aa = new ActorsUtils();
		AllCateUtil aa = new AllCateUtil();

		data_base = aa.getArtist_allChildrenCate();
		actor_type_data = new ArrayList<String>();
		for (Map<String, String> map : data_base) {
			actor_type_data.add(map.get("item_name"));
		}

		ArrayAdapter<String> data_adapter = new ArrayAdapter<String>(this,
				android.R.layout.simple_list_item_1, actor_type_data);

		this.setListAdapter(data_adapter);
		this.getListView().setOnItemClickListener(this);

	}

	public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) {
		// TODO Auto-generated method stub
		Intent re_intent = new Intent();
		re_intent.putExtra("actor_TYPE_ID", data_base.get(arg2).get("item_id"));// 下一个页面需要id作为查询条件
		re_intent.setClass(this, Cate_Actor_Name.class);
		startActivity(re_intent);
		// System.out.println(data_base.get(arg2).get("item_id"));//
		// 获取歌手类型的id
	}

}
